
package com.zkmonitor.util;

import org.I0Itec.zkclient.serialize.ZkSerializer;

import java.nio.charset.Charset;


public class StringSerializer implements ZkSerializer {

    private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

    @Override
    public byte[] serialize(Object data) {
        return data.toString().getBytes(DEFAULT_CHARSET);
    }

    @Override
    public String deserialize(byte[] bytes) {
        return new String(bytes, DEFAULT_CHARSET);
    }
}